package com.shixi.shixitraining.shixitraining.base;

import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

/**
 * 防止fragment重复创建
 * Created by shenyan on 2018/7/5.
 *
 */

public  abstract class TabhostBaseFragment extends BaseFragment {

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {


        if (mContentView!=null){
            ViewGroup parent = (ViewGroup) mContentView.getParent();
            if (parent!=null){
                parent.removeView(mContentView);
            }
            return mContentView;
        }
        return super.onCreateView(inflater, container, savedInstanceState);
    }

}
